package exception;

import java.io.FileOutputStream;
import java.io.IOException;

public class FinallyDemo3 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=null;
        try{
            fos=new FileOutputStream("fos.dat");
            fos.write(1);
        } catch (IOException e) {
            System.out.println("出错了");
        }finally{
            fos.close();
            System.out.println("程序已关闭");
        }
    }
}
